package com.gxa.xly2024.controller;

import com.gxa.xly2024.pojo.Employee;
import com.gxa.xly2024.service.impl.EmployeeServiceImpl;
import com.gxa.xly2024.vo.VO;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("/employee")
public class EmployeeController {

    @Resource
    private EmployeeServiceImpl employeeService;

    @GetMapping("/selectEmployeeById")
    public Map<String, Object> selectEmployee(Integer id) {
        return this.employeeService.selectEmployeeById(id);
    }

    @GetMapping("/selectEmployeeByLimit")
    public Map<String, Object> selectEmployeeByLimit(VO vo) {
        return this.employeeService.selectEmployeeByLimit(vo);
    }

    @PostMapping("/insert_Employee")
    public Map<String, Object> insert(@RequestBody Employee employee) {   // 接收前端传递的json对象
        return this.employeeService.insert(employee);
    }

    @PostMapping("/updateById_Employee")
    public Map<String, Object> updateById(@RequestBody Employee employee) {   // 接收前端传递的json对象
        return this.employeeService.updateById(employee);
    }
    @PostMapping("/deleteById_Employee")
    public Map<String, Object> deleteById(Integer id) {   // 接收前端传递的json对象
        return this.employeeService.deleteById(id);
    }
}
